/*
 * gxtEntryPoint.java
 *
 * Created on 2009年5月15日, 下午9:31
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.erp.client;

import com.erp.client.DAO.*;
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.MenuEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.Window.CloseAction;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ToolButton;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.layout.AccordionLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.extjs.gxt.ui.client.widget.tree.Tree;
import com.extjs.gxt.ui.client.widget.tree.TreeItem;
import com.google.gwt.core.client.EntryPoint;
import com.erp.client.MessAge.myMessage;
import com.erp.client.MessAge.myMesswindow;
import com.erp.client.widget.*;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.button.StatusButtonBar;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.DateTimePropertyEditor;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import java.util.Date;

public class systemEntryPoint implements EntryPoint {

    public static String systemUserLabelName = "";
    public static Integer loginstate = 0;
    public static int StaticEmpID = 0;
    public static int StaticDepId = 0;
    public static String StaticUserName = "";
    public static String StaticDepName = "";
    private Desktop desktop = new Desktop();
    private myMessage mess = new myMessage();
    private String Stringreturn = "";
    private ServerUserBaseAsync service;
    private ListStore<BeanModel> store;
    private ListLoader loader;
    private Grid<BeanModel> grid;
    final private myMesswindow messdisp = new myMesswindow();
    protected FormPanel form;
    protected StatusButtonBar buttonBar;
    protected ServerUserBaseAsync customerService;

    @Override
    public void onModuleLoad() {



        Button reset;
        Button save;

        final Window w = new Window();
        w.setPlain(true);
        w.setSize(300, -1);
        w.setHeading("登录窗口");
        w.setLayout(new FitLayout());

        final FormPanel panel = new FormPanel();
        panel.setBorders(false);
        panel.setBodyBorder(false);
        panel.setLabelWidth(60);
        panel.setPadding(5);
        panel.setHeaderVisible(false);
        panel.setButtonAlign(HorizontalAlignment.CENTER);


        final TextField<String> loginId = new TextField<String>();
        //loginId.setName("loginId");
        loginId.setFieldLabel(" 用户名 ");
        loginId.setAllowBlank(false);
        loginId.setMinLength(2);
        loginId.setMaxLength(10);
        loginId.setEmptyText("请输入用户名");
        loginId.setMessageTarget("请输入用户名");
        panel.add(loginId, new FormData("100%"));

        final TextField<String> password = new TextField<String>();
        //password.setName("password");
        password.setFieldLabel(" 密 码 ");
        password.setAllowBlank(false);
        //password.setMinLength(4);
        password.setMaxLength(20);
        password.setEmptyText("请输入密码");
        password.setMessageTarget("请输入密码");
        panel.add(password, new FormData("100%"));



        buttonBar = new StatusButtonBar();
        //setButtonBar(buttonBar);
        reset = new Button("重置");
        reset.addSelectionListener(new SelectionListener<ButtonEvent>() {

            public void componentSelected(ButtonEvent ce) {
                //myUpdataRzlogDialog.this.hide();
                Info.display("Event", "The '重置' tool was clicked");
                panel.reset();

            }
        });

        save = new Button("确定");

        save.addSelectionListener(new SelectionListener<ButtonEvent>() {

            public void componentSelected(ButtonEvent ce) {
                //Info.display("Event", "The '保存' tool was clicked");
                UserBaseInf ub = new UserBaseInf();
                ub.setLoginId(loginId.getValue().toString());
                ub.setPassword(password.getValue().toString());
                buttonBar.disable();
                AsyncCallback callback = new AsyncCallback() {

                    public void onSuccess(Object result) {
                        buttonBar.enable();
                        if (((String) result) == "Success") {
                            messdisp.myMessWindow("系统提示", "登录成功！");
                            loginstate = 1;
                            w.close();
                            systemset();
                        } else {
                            messdisp.myMessWindow("系统提示", "登录用户名或者密码错误！");
                        }
                    }

                    public void onFailure(Throwable caught) {
                        Info.display("系统提示", "登录用户名或者密码错误！");
                        buttonBar.enable();
                    }
                };
                ServerUserBaseGetService.getService().UserRightsLogin(ub, callback);

            }
        });

        buttonBar.add(save);
        buttonBar.add(reset);

        w.setButtonBar(buttonBar);
        w.add(panel);
        w.show();

    }

    private void systemset() {
        AsyncCallback callback = new AsyncCallback() {

            @Override
            public void onSuccess(Object result) {
                Info.display("Event", "The '登录信息取回成功' ");
                List<UserBaseInf> lls = (List<UserBaseInf>) result;

                StaticEmpID = lls.get(0).getUserId();
                StaticDepId = lls.get(0).getDepId();
                StaticUserName = lls.get(0).getUserName();
                StaticDepName = lls.get(0).getDepName();
                systemUserLabelName = StaticUserName + "      [" + StaticDepName + "]";

                buildUI();

            }

            @Override
            public void onFailure(Throwable caught) {
                Info.display("server", "server连接失败");
            }
        };
        ServerUserBaseGetService.getService().UserRightsGet(callback);
    }

    private void buildUI() {
        SelectionListener<ComponentEvent> listener = new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {

                if (loginstate != 0) {
                    Window w = null;
                    if (ce instanceof MenuEvent) {
                        MenuEvent me = (MenuEvent) ce;
                        w = me.item.getData("window");
                    } else {
                        w = ce.component.getData("window");
                    }
                    if (!desktop.getWindows().contains(w)) {
                        desktop.addWindow(w);
                    }
                    if (w != null && !w.isVisible()) {
                        w.show();
                    } else {
                        w.toFront();
                    }
                } else {
                    new myLoginDialog();
                }
            }
        };

        Window gridWindow = createRzLogGridWindow();
        Window accordionWindow = createAccordionWindow();
        Window changepasswordWindow = createChangepasswordWindow();



        Shortcut s1 = new Shortcut();
        s1.setText("我的日志");
        s1.setToolTip("个人事务模块是为提高员工的日常工作效率提供的个性化服务功能。在这里，员工可以及时了解需要办理的各项事务，进行自己的工作日程安排，管理个人名片夹，收发电子邮件，同时可以进行自己的日常财务管理，修改个人的登录口令等。功能包括：员工待办事宜、我的邮件、个人办公申请、个人名片夹、个人日程、个人理财、签退、我要离线、修改口令、收发短信息、设置定时提醒、查看当前在线人员情况。");
        s1.setId("grid-win-shortcut");
        s1.setData("window", gridWindow);
        s1.addSelectionListener(listener);
        desktop.addShortcut(s1);

        Shortcut s2 = new Shortcut();
        s2.setText("通讯簿");
        s2.setId("acc-win-shortcut");
        s2.setData("window", accordionWindow);
        s2.addSelectionListener(listener);
        desktop.addShortcut(s2);

        Shortcut s3 = new Shortcut();
        s3.setText("相关功能说明");
        s3.setId("grid-win-shortcut");
        s3.setData("window", createTabWindow());
        s3.addSelectionListener(listener);
        desktop.addShortcut(s3);

        TaskBar taskBar = desktop.getTaskBar();

        StartMenu menu = taskBar.getStartMenu();
        menu.setHeading(systemUserLabelName);
        menu.setIconStyle("user");

//***********************个人工具菜单************************************
        MenuItem menuItem = new MenuItem("个人工具");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu sub = new Menu();
        MenuItem item = new MenuItem("我的便笺");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        item = new MenuItem("办公申请");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        item = new MenuItem("名片管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        item = new MenuItem("离线设置");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        item = new MenuItem("修改密码");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        item = new MenuItem("BBS论坛");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        sub.add(item);
        menuItem.setSubMenu(sub);
        menu.add(menuItem);
        /*
        menuItem = new MenuItem("Bogus Submenu");
        menuItem.setIconStyle("bogus");
        Menu sub = new Menu();
        for (int i = 0; i < 5; i++) {
        MenuItem item = new MenuItem("Bogus Window " + (i + 1));
        item.setData("window", createBogusWindow(i));
        item.addSelectionListener(listener);
        sub.add(item);
        }
        menuItem.setSubMenu(sub);
        menu.add(menuItem);
         */
//***********************个人工具菜单************************************
//***********************工作计划菜单************************************
        menuItem = new MenuItem("工作计划");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subgzjh = new Menu();
        MenuItem itemgzjh = new MenuItem("工作计划");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("日志填写");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("部门日志");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("部门计划");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("报告类别");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("计划类别");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        itemgzjh = new MenuItem("全部计划");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgzjh.add(itemgzjh);

        menuItem.setSubMenu(subgzjh);
        menu.add(menuItem);
//***********************工作计划菜单************************************
//***********************公文流转菜单************************************
        menuItem = new MenuItem("公文流转");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subgwlz = new Menu();

        MenuItem itemgwlz = new MenuItem("发文拟制");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("收文登记");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("公文办理");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("公文办理");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("公文催办");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("公文跳转");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("归档销毁");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("公文查询");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        itemgwlz = new MenuItem("参数设置");
        //itemgzjh = new MenuItem("工作计划1");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subgwlz.add(itemgwlz);

        menuItem.setSubMenu(subgwlz);
        menu.add(menuItem);
//***********************公文流转菜单************************************
//***********************文档管理菜单************************************
        menuItem = new MenuItem("文档管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subwdgl = new Menu();
        
        MenuItem itemwdgl = new MenuItem("文档发布");
        //item.setData(, item);
        itemwdgl.addSelectionListener(new SelectionListener<ComponentEvent>() {
            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display("Event", "The '文档发布' tool was clicked");
                new myFileUpload();
            }
        });
        //itemwdgl.addSelectionListener(listener);
        subwdgl.add(itemwdgl);

        itemwdgl = new MenuItem("文档查询");
        //itemwdgl.setData("window", createFileListGridWindow());
        itemwdgl.addSelectionListener(new SelectionListener<ComponentEvent>() {
            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display("Event", "The '文档查询' tool was clicked");
               new myFileDownDialog();
            }
        });
        subwdgl.add(itemwdgl);


        itemwdgl = new MenuItem("类别管理");
        //item.setData("", item);
        itemwdgl.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display("Event", "The '类别管理' tool was clicked");
            }
        });
        subwdgl.add(itemwdgl);

        menuItem.setSubMenu(subwdgl);
        menu.add(menuItem);
//***********************文档管理菜单************************************
//***********************客户资源菜单****************************************
        menuItem = new MenuItem("客户资源");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subkhzy = new Menu();
        MenuItem itemkhzy = new MenuItem("客户管理");
        //itemgzjh = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkhzy.add(itemkhzy);

        itemkhzy = new MenuItem("联系记录");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkhzy.add(itemkhzy);

        itemkhzy = new MenuItem("维修情况");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkhzy.add(itemkhzy);

        itemkhzy = new MenuItem("字典维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkhzy.add(itemkhzy);

        itemkhzy = new MenuItem("维修人员");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkhzy.add(itemkhzy);


        menuItem.setSubMenu(subkhzy);
        menu.add(menuItem);
//***********************客户资源菜单*******************************
//***********************车辆管理菜单*******************************
        menuItem = new MenuItem("车辆管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subclgl = new Menu();
        MenuItem itemclgl = new MenuItem("用车情况");
        //itemclgl = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subclgl.add(itemclgl);

        itemclgl = new MenuItem("车辆信息");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subclgl.add(itemclgl);

        itemclgl = new MenuItem("油耗管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subclgl.add(itemclgl);

        itemclgl = new MenuItem("维修情况");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subclgl.add(itemclgl);

        menuItem.setSubMenu(subclgl);
        menu.add(menuItem);
//***********************车辆管理菜单*******************************
//***********************资产管理菜单*******************************
        menuItem = new MenuItem("资产管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subzcgl = new Menu();
        MenuItem itemzcgl = new MenuItem("资产信息");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subzcgl.add(itemzcgl);

        itemzcgl = new MenuItem("使用管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subzcgl.add(itemzcgl);

        itemzcgl = new MenuItem("部门资产");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subzcgl.add(itemzcgl);

        itemzcgl = new MenuItem("全部资产");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subzcgl.add(itemzcgl);

        itemzcgl = new MenuItem("字典维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subzcgl.add(itemzcgl);

        menuItem.setSubMenu(subzcgl);
        menu.add(menuItem);
//***********************资产管理菜单*******************************
//***********************人力资源菜单*******************************
        menuItem = new MenuItem("人力资源");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subrlzy = new Menu();
        MenuItem itemrlzy = new MenuItem("信息维护");
        //itemrlzy = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        itemrlzy = new MenuItem("调动分配");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        itemrlzy = new MenuItem("离职人员");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        itemrlzy = new MenuItem("部门人事");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        itemrlzy = new MenuItem("全体人事");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        itemrlzy = new MenuItem("人事字典");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subrlzy.add(itemrlzy);

        menuItem.setSubMenu(subrlzy);
        menu.add(menuItem);
//***********************人力资源菜单*******************************
//***********************办公用品菜单*******************************
        menuItem = new MenuItem("办公用品");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subbgyp = new Menu();
        MenuItem itembgyp = new MenuItem("用品管理");
        //itembgyp = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("预算管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("用品采购");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("用品统计");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("部门统计");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("库存报警");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        itembgyp = new MenuItem("类别维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subbgyp.add(itembgyp);

        menuItem.setSubMenu(subbgyp);
        menu.add(menuItem);
//***********************办公用品菜单*******************************
//***********************考勤管理菜单*******************************
        menuItem = new MenuItem("考勤管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subkqgl = new Menu();
        MenuItem itemkqgl = new MenuItem("请假销假");
        //itemkqgl = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("销假核准");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("加班确认");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("加班核准");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("统计生成");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("统计查询");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("个人查询");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("全部查询");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("参数维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("设休息日");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        itemkqgl = new MenuItem("类别维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subkqgl.add(itemkqgl);

        menuItem.setSubMenu(subkqgl);
        menu.add(menuItem);
//***********************考勤管理菜单*******************************
//***********************会议管理菜单*******************************
        menuItem = new MenuItem("会议管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subhygl = new Menu();
        MenuItem itemhygl = new MenuItem("会议登记");
        //itemhygl = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        itemhygl = new MenuItem("会议通知");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        itemhygl = new MenuItem("会议纪要");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        itemhygl = new MenuItem("会议信息");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        itemhygl = new MenuItem("会议室管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        itemhygl = new MenuItem("会议室查询");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subhygl.add(itemhygl);

        menuItem.setSubMenu(subhygl);
        menu.add(menuItem);
//***********************会议管理菜单*******************************
//***********************菜单模板************************************
        menuItem = new MenuItem("物资管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subwzgl = new Menu();
        MenuItem itemwzgl = new MenuItem("材料计划");
        //itemwzgl = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwzgl.add(itemwzgl);

        itemwzgl = new MenuItem("材料审核");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwzgl.add(itemwzgl);

        itemwzgl = new MenuItem("物资查询");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwzgl.add(itemwzgl);

        itemwzgl = new MenuItem("库存告警");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwzgl.add(itemwzgl);

        itemwzgl = new MenuItem("物资维护");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwzgl.add(itemwzgl);

        menuItem.setSubMenu(subwzgl);
        menu.add(menuItem);
//***********************菜单模板************************************/
//***********************系统管理菜单*******************************
        menuItem = new MenuItem("系统管理");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subxtgl = new Menu();
        MenuItem itemxtgl = new MenuItem("机构配置");
        //itemxtgl = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        itemxtgl = new MenuItem("部门配置");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        itemxtgl = new MenuItem("信息管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        itemxtgl = new MenuItem("人员管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        itemxtgl = new MenuItem("角色管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        itemxtgl = new MenuItem("权限管理");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subxtgl.add(itemxtgl);

        menuItem.setSubMenu(subxtgl);
        menu.add(menuItem);
//***********************系统管理菜单*******************************
        /***********************菜单模板************************************
        menuItem = new MenuItem("菜单名称");
        menuItem.setIconStyle("accordion");
        //menuItem.addSelectionListener(listener);
        //menuItem.setData("window", accordionWindow);
        Menu subwdgl = new Menu();
        MenuItem itemwdgl = new MenuItem("子菜单");
        //itemgzjh = new MenuItem("子菜单项");
        //item.setData("", item);
        //item.addSelectionListener(listener);
        subwdgl.add(itemwdgl);
        menuItem.setSubMenu(subgwlz);
        menu.add(menuItem);
         ***********************菜单模板************************************/
//***********************右侧系统工具菜单***************************
        // tools
        MenuItem tool = new MenuItem("密码设置");
        tool.setIconStyle("settings");
        //tool.setData("window", createChangepasswordWindow());
        tool.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                new myChangePassword();
            }
        });
        //tool.addSelectionListener(listener);
        menu.addTool(tool);
        menu.addToolSeperator();

        tool = new MenuItem("退  出");
        tool.setIconStyle("logout");
        tool.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display("Event", "The '退  出' tool was clicked");

                AsyncCallback callback = new AsyncCallback() {

                    public void onSuccess(Object result) {
                        //Info.display("server", ((String) result));
                        //String ls = ((String) result);
                        List<SeriaRzLog> ls = (List<SeriaRzLog>) result;
                        //test lls = new test();
                        //lls.ttestarray(ls);
                        // myMesswindow messdisp = new myMesswindow();
                        messdisp.myMessWindow("server", ls.get(0).getRecData().toString() + " : " + ls.get(1).getRecData().toString() + " : " + ls.get(1).getRecDate());
                    //messdisp.myMessWindow("ttestarray　server", lls.ttestarray(ls));
                    //messdisp.myMessWindow("stock server", lls.testarray(ls).get(0).toString());
                    //messdisp.myMessWindow("mytestarray　server", lls.mytestarray(ls).get(0).toString());
                    //messdisp.myMessWindow(mess.systemMess1, ((String) result));
                    }

                    public void onFailure(Throwable caught) {
                        Info.display("server", "server连接失败");
                    }
                };
                //ServerUserBaseGetService.getService().myTest("tt", callback);
                //ServerUserBaseGetService.getService().rzls(callback);
                ServerUserBaseGetService.getService().getRzlogAll(callback);

            }
        });
        menu.addTool(tool);



    /***********************右侧系统工具菜单************************************/
    /***********************登录开始************************************/
    //messdisp.myMessWindow(null,userName );
    /***********************右侧系统工具菜单************************************/
    }

    private Window createRzLogGridWindow() {
        final Window w = new Window();
        w.setCloseAction(CloseAction.HIDE);
        w.setIconStyle("icon-grid");
        w.setMinimizable(true);
        w.setMaximizable(true);
        w.setHeading("我的日志");
        w.setSize(500, 400);
        w.setBorders(true);
        w.setLayout(new FitLayout());

        service = (ServerUserBaseAsync) GWT.create(ServerUserBase.class);
        ServiceDefTarget endpoint = (ServiceDefTarget) service;
        String moduleRelativeURL = GWT.getModuleBaseURL() + "dao/serveruserbase";
        endpoint.setServiceEntryPoint(moduleRelativeURL);

        //System.out.print(StaticEmpID);
        RpcProxy proxy = new RpcProxy() {

            @Override
            public void load(Object loadConfig, AsyncCallback callback) {
                //service.getRzlogByrzid(StaticEmpID, callback);
                RzLogFind rzlogfind = new RzLogFind(StaticEmpID, new Date(), new Date());
                service.getRzlogByDate(rzlogfind, callback);//getRzlogAll(callback);
            //service.getRzlogByDate(StaticEmpID, df.parse((new Date()).toString()),df.parse((new Date()).toString()), callback);
            }
        };
        loader = new BaseListLoader(proxy, new BeanModelReader());
        loader.load();
        store = new ListStore<BeanModel>(loader);

        ColumnConfig rzid = new ColumnConfig("rzId", "日志序号", 60);
        ColumnConfig empid = new ColumnConfig("empId", "记录者ID", 60);
        ColumnConfig empname = new ColumnConfig("empName", "姓名", 100);
        ColumnConfig depid = new ColumnConfig("depId", "部门ID", 60);
        ColumnConfig depName = new ColumnConfig("depName", "部门名称", 60);
        ColumnConfig recdate = new ColumnConfig("recDate", "日　期", 80);
        ColumnConfig week = new ColumnConfig("week", "星　期", 70);
        ColumnConfig beginTime = new ColumnConfig("beginTime", "开始时间", 70);
        ColumnConfig endTime = new ColumnConfig("endTime", "结束时间", 70);
        ColumnConfig recdata = new ColumnConfig("recData", "日志内容", 200);
        ColumnConfig inputdate = new ColumnConfig("inputDate", "输入日期", 80);
        ColumnConfig mangeid = new ColumnConfig("mangeId", "管理者ID", 100);
        ColumnConfig mangedemo = new ColumnConfig("mangeDemo", "管理者评语", 100);
        ColumnConfig mangenumerical = new ColumnConfig("mangeNumerical", "管理点评分数", 100);
        empname.setHidden(true);
        empid.setHidden(true);
        empid.setMenuDisabled(true);
        //recdate.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
        //inputdate.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
        mangeid.setHidden(true);
        mangeid.setMenuDisabled(true);
        rzid.setHidden(true);
        rzid.setSortable(false);
        rzid.setMenuDisabled(true);
        depid.setHidden(true);
        depid.setSortable(false);
        depName.setHidden(true);
        depName.setSortable(false);
        recdate.setMenuDisabled(true);
        recdata.setMenuDisabled(true);
        week.setMenuDisabled(true);
        beginTime.setMenuDisabled(true);
        endTime.setMenuDisabled(true);
        inputdate.setMenuDisabled(true);
        mangedemo.setMenuDisabled(true);
        mangedemo.setHidden(true);
        mangenumerical.setHidden(true);
        mangenumerical.setMenuDisabled(true);
        recdate.setMenuDisabled(true);
        List<ColumnConfig> config = new ArrayList<ColumnConfig>();

        config.add(rzid);
        config.add(empid);
        config.add(empname);
        config.add(depid);
        config.add(depName);
        config.add(recdate);
        config.add(week);
        config.add(beginTime);
        config.add(endTime);
        config.add(recdata);
        config.add(inputdate);
        config.add(mangeid);
        config.add(mangedemo);
        config.add(mangenumerical);
        final ColumnModel cm = new ColumnModel(config);

        grid = new Grid<BeanModel>(store, cm);
        grid.setWidth(400);
        grid.setBorders(true);
        grid.setAutoExpandColumn("rzId");
        //grid.setBorders(false);
        //cp.setSize(600, 200);


        final ContentPanel cp = new ContentPanel();
        cp.setFrame(true);
        cp.setHeading("Local Paging Grid");
        cp.setButtonAlign(HorizontalAlignment.CENTER);
        cp.setHeaderVisible(false);
        cp.setLayout(new FitLayout());



        final DateTimePropertyEditor propertyEditor = new DateTimePropertyEditor("yyyy-MM-dd");

        final DateField begindate = new DateField();
        begindate.setPropertyEditor(propertyEditor);
        begindate.setAutoValidate(true);
        begindate.setName("begindate");
        begindate.setFieldLabel("开始日期");
        begindate.setAllowBlank(false);
        final Date dt = new Date();
        begindate.setValue(dt);
        begindate.setEmptyText("请选择日期");
        begindate.setMessageTarget("请选择日期");


        final DateField enddate = new DateField();
        enddate.setPropertyEditor(propertyEditor);
        enddate.setAutoValidate(true);
        enddate.setName("enddate");
        enddate.setFieldLabel("结束日期");
        enddate.setAllowBlank(false);
        enddate.setValue(dt);
        enddate.setEmptyText("请选择日期");
        enddate.setMessageTarget("请选择日期");

        final Dialog complex = new Dialog();



        buttonBar = new StatusButtonBar();
        Button reset = new Button("重置");
        reset.addSelectionListener(new SelectionListener<ButtonEvent>() {

            public void componentSelected(ButtonEvent ce) {
                begindate.setValue(dt);
                enddate.setValue(dt);

            }
        });

        Button save = new Button("确定");

        save.addSelectionListener(new SelectionListener<ButtonEvent>() {

            public void componentSelected(ButtonEvent ce) {

                RpcProxy proxy = new RpcProxy() {

                    @Override
                    public void load(Object loadConfig, AsyncCallback callback) {

                        //service.getRzlogByrzid(StaticEmpID, callback);//getRzlogAll(callback);
                        RzLogFind rzlogfind = new RzLogFind(StaticEmpID, begindate.getValue(), enddate.getValue());
                        service.getRzlogByDate(rzlogfind, callback);//getRzlogAll(callback);
                    }
                };
                loader = new BaseListLoader(proxy, new BeanModelReader());
                store = new ListStore<BeanModel>(loader);
                loader.load();

                grid.reconfigure(store, cm);
                complex.close();
            }
        });

        buttonBar.add(save);
        buttonBar.add(reset);

        complex.setBodyBorder(false);
        complex.setButtons("");
        complex.setIconStyle("icon-app-side");
        complex.setHeading("日志查询");
        complex.setWidth(307);
        complex.setHeight(121);
        complex.setHideOnButtonClick(false);

        FormPanel panel = new FormPanel();
        panel.setBorders(false);
        panel.setBodyBorder(false);
        panel.setLabelWidth(70);
        panel.setPadding(5);
        panel.setHeaderVisible(false);

        //ContentPanel panel = new ContentPanel();
        panel.setHeading("请选择");
        panel.add(begindate);
        panel.add(enddate);
        panel.setButtonBar(buttonBar);
        complex.add(panel);
        cp.add(grid);
        w.add(cp);


        ToolBar toolBar = new ToolBar();
        TextToolItem item = new TextToolItem();
        item.setText("查找");
        //item.setIconStyle("icon-connect");
        item.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display("Event", "The '查找记录' tool was clicked");
                complex.show();
            //new myFindRzlogDialog(StaticEmpID,StaticUserName,StaticDepId,StaticDepName);
            }
        });
        toolBar.add(item);
        toolBar.add(new SeparatorToolItem());
        w.setTopComponent(toolBar);

        item = new TextToolItem();
        item.setText("增加新记录");
        //item.setIconStyle("icon-user-add");
        item.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {

                Info.display("Event", "The '增加新记录' tool was clicked");
                new myInsertRzlogDialog(service, store, new SeriaRzLog());
            }
        });
        toolBar.add(item);
        toolBar.add(new SeparatorToolItem());
        w.setTopComponent(toolBar);

        item = new TextToolItem();
        item.setText("修改记录");
        //item.setIconStyle("icon-user-delete");
        item.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                if (grid.getSelectionModel().getSelectedItems() == null || grid.getSelectionModel().getSelectedItems().size() <= 0) {
                    messdisp.myMessWindow("提示信息", "请选择一条记录！");
                } else {
                    Info.display("Event", "The '修改记录' tool was clicked");
                    SeriaRzLog customer = grid.getSelectionModel().getSelectedItem().getBean();
                    new myUpdataRzlogDialog(service, store, customer);
                }
            }
        });

        toolBar.add(item);
        toolBar.add(new SeparatorToolItem());
        w.setTopComponent(toolBar);

        item = new TextToolItem();
        item.setText("刷新");
        item.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {

                Info.display("Event", "The '刷新' tool was clicked");
                RpcProxy proxy = new RpcProxy() {

                    @Override
                    public void load(Object loadConfig, AsyncCallback callback) {
                        //System.out.print(StaticEmpID+0000);
                        RzLogFind rzlogfind = new RzLogFind(StaticEmpID, new Date(), new Date());
                        service.getRzlogByDate(rzlogfind, callback);
                    //service.getRzlogByrzid(StaticEmpID, callback);//getRzlogAll(callback);
                    }
                };
                loader = new BaseListLoader(proxy, new BeanModelReader());
                store = new ListStore<BeanModel>(loader);
                loader.load();

                grid.reconfigure(store, cm);

            }
        });
        toolBar.add(item);


        return w;
    }

    private Window createFileListGridWindow() {
        final Window w = new Window();
        w.setPlain(true);
        w.setSize(340, 260);
        w.setHeading("文档查询");
        w.setLayout(new FitLayout());

        final FormPanel panel = new FormPanel();

        panel.setHeading("请选择文件");
        panel.setBorders(false);
        panel.setBodyBorder(false);
        panel.setLabelWidth(60);
        panel.setPadding(5);
        panel.setHeaderVisible(false);
        panel.setButtonAlign(HorizontalAlignment.CENTER);

        service = (ServerUserBaseAsync) GWT.create(ServerUserBase.class);
        ServiceDefTarget endpoint = (ServiceDefTarget) service;
        String moduleRelativeURL = GWT.getModuleBaseURL() + "dao/serveruserbase";
        endpoint.setServiceEntryPoint(moduleRelativeURL);

        //System.out.print(StaticEmpID);
        RpcProxy proxy = new RpcProxy() {

            @Override
            public void load(Object loadConfig, AsyncCallback callback) {
                service.getFileByID(StaticEmpID, callback);

            }
        };
        System.out.print(StaticEmpID);
        loader = new BaseListLoader(proxy, new BeanModelReader());
        store = new ListStore<BeanModel>(loader);
        loader.load();

        ColumnConfig fileid = new ColumnConfig("fileID", "文件序号", 60);
        ColumnConfig empid = new ColumnConfig("empId", "记录者ID", 60);
        ColumnConfig filename = new ColumnConfig("fileName", "文件全名", 100);
        ColumnConfig filetype = new ColumnConfig("fileType", "文件类型", 60);
        ColumnConfig Myfile = new ColumnConfig("myfile", "文件名", 100);
        ColumnConfig username = new ColumnConfig("userName", "文档所有者", 60);
        ColumnConfig depname = new ColumnConfig("depName", "部门名称", 60);
        ColumnConfig recdate = new ColumnConfig("recDate", "上传日期", 100);
        ColumnConfig delflag = new ColumnConfig("delFlag", "删除标志", 60);
        fileid.setHidden(true);
        empid.setHidden(true);
        filename.setHidden(true);
        delflag.setHidden(true);
        Myfile.setMenuDisabled(true);
        filetype.setMenuDisabled(true);
        username.setMenuDisabled(true);
        depname.setMenuDisabled(true);
        recdate.setMenuDisabled(true);
        List<ColumnConfig> config = new ArrayList<ColumnConfig>();
        config.add(fileid);
        config.add(empid);
        config.add(filename);
        config.add(delflag);
        config.add(Myfile);
        config.add(filetype);
        config.add(username);
        config.add(depname);
        config.add(recdate);
        final ColumnModel cm = new ColumnModel(config);
        Grid gridFile = new Grid<BeanModel>(store, cm);
        gridFile.setWidth(400);
        gridFile.setBorders(true);
        gridFile.setAutoExpandColumn("fileID");
        panel.add(gridFile);

        //panel.setAction("com.erp.system/serverupload");
        //panel.setAction("com.erp.system/myfiledown?"+"id1=12"+"&id2=cd");
        Button btn = new Button("下载");
        btn.addSelectionListener(new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent ce) {

                if (!panel.isValid()) {
                    return;
                }
                panel.submit();
                Info.display("系统提示", "文件传输成功！");
            //w.close();
            }
        });
        panel.addButton(btn);
        w.add(panel);
        return w;

    }

    private Window createAccordionWindow() {
        final Window w = new Window();
        w.setCloseAction(CloseAction.HIDE);
        w.setMinimizable(true);
        w.setMaximizable(true);
        w.setIconStyle("accordion");
        w.setHeading("通讯簿");
        w.setWidth(200);
        w.setHeight(350);

        ToolBar toolBar = new ToolBar();

        TextToolItem item = new TextToolItem();
        item.setText("查找");


        //item.setIconStyle("icon-connect");
        toolBar.add(item);

        toolBar.add(new SeparatorToolItem());
        w.setTopComponent(toolBar);

        item =
                new TextToolItem();
        item.setText("fufufufuf2");
        item.setIconStyle("icon-user-add");
        toolBar.add(item);

        item =
                new TextToolItem();
        item.setText("fufufufuf3");
        item.setIconStyle("icon-user-delete");
        toolBar.add(item);

        w.setLayout(new AccordionLayout());

        ContentPanel cp = new ContentPanel();
        cp.setHeading("在线用户");
        cp.setScrollMode(Scroll.AUTO);
        cp.getHeader().addTool(new ToolButton("x-tool-refresh"));

        w.add(cp);

        Tree tree = new Tree();
        TreeItem family = new TreeItem("Family");
        tree.getRootItem().add(family);
        family.add(newItem("Darrell", "user"));
        family.add(newItem("Maro", "user-girl"));
        family.add(newItem("Lia", "user-kid"));
        family.add(newItem("Alec", "user-kid"));
        family.setExpanded(true);

        TreeItem friends = new TreeItem("Friends");
        tree.getRootItem().add(friends);
        friends.add(newItem("Abe", "user"));
        friends.add(newItem("Mary", "user-girl"));
        friends.add(newItem("Sally", "user-girl"));
        friends.add(newItem("Jack", "user"));
        friends.setExpanded(true);

        cp.add(tree);

        cp =
                new ContentPanel();
        cp.setHeading("设置");
        cp.setBodyStyleName("pad-text");
//    cp.addText(TestData.DUMMY_TEXT_SHORT);
        w.add(cp);

        cp =
                new ContentPanel();
        cp.setHeading("Stuff");
        cp.setBodyStyleName("pad-text");
        //  cp.addText(TestData.DUMMY_TEXT_SHORT);
        w.add(cp);

        cp =
                new ContentPanel();
        cp.setHeading("More Stuff");
        cp.setBodyStyleName("pad-text");
        // cp.addText(TestData.DUMMY_TEXT_SHORT);
        w.add(cp);
        return w;
    }

    private Window createTabWindow() {
        Window w = new Window();
        w.setCloseAction(CloseAction.HIDE);
        w.setMinimizable(true);
        w.setMaximizable(true);
        w.setSize(740, 480);
        w.setIconStyle("tabs");
        w.setHeading("Tab Window");

        w.setLayout(new FitLayout());

        TabPanel panel = new TabPanel();

        /*for (int i = 0; i < 4; i++) {
        TabItem item = new TabItem("Tab Item " + (i + 1));
        item.addText("Something useful would be here");
        panel.add(item);
        }*/
        TabItem item = new TabItem("Tab Item " + 1);
        item.addText("");
        panel.add(item);

        w.add(panel);
        return w;
    }

    private TreeItem newItem(String text, String iconStyle) {
        TreeItem item = new TreeItem(text);
        item.setIconStyle(iconStyle);
        return item;
    }

    private Window createBogusWindow(int index) {
        Window w = new Window();
        w.setCloseAction(CloseAction.HIDE);
        w.setIconStyle("bogus");
        w.setMinimizable(true);
        w.setMaximizable(true);
        w.setHeading("Bogus Window " + ++index);
        w.setSize(400, 300);
        return w;
    }

    private Window createChangepasswordWindow() {
        final Window w = new Window();

        w.setMinimizable(false);
        w.setMaximizable(false);
        w.setResizable(false);
        w.setIconStyle("bogus");
        w.setPlain(true);
        w.setSize(320, 150);
        w.setHeading("系统设置：更改密码");
        w.setLayout(new FitLayout());

        final FormPanel panel = new FormPanel();
        panel.setBorders(false);
        panel.setBodyBorder(false);
        panel.setLabelWidth(100);
        //panel.setPadding(5);
        panel.setHeaderVisible(false);
        panel.reset();

        final TextField<String> oldpassword = new TextField<String>();
        oldpassword.setFieldLabel("请输入现用密码");
        oldpassword.setMaxLength(12);
        oldpassword.setPassword(true);
        panel.add(oldpassword, new FormData("100%"));

        final TextField<String> newpassword = new TextField<String>();
        newpassword.setFieldLabel("请输入新密码");
        newpassword.setMinLength(4);
        newpassword.setMaxLength(12);
        newpassword.setPassword(true);
        panel.add(newpassword, new FormData("100%"));

        final TextField<String> renewpassword = new TextField<String>();
        renewpassword.setFieldLabel("请输入新密码");
        renewpassword.setMinLength(4);
        renewpassword.setMaxLength(12);
        renewpassword.setPassword(true);
        panel.add(renewpassword, new FormData("100%"));

        Button changepassowrdOK = new Button("确定");

        changepassowrdOK.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                if (oldpassword.getValue() != null && (newpassword.getValue() == renewpassword.getValue())) {
                    //Info.display(mess.systemMess1, ":" + "The 'Settings' tool was clicked");

                    Info.display(mess.systemMess1, Stringreturn);
                    myMesswindow messdisp = new myMesswindow();
                    messdisp.myMessWindow(mess.systemMess1, oldpassword.getValue() + ";" + newpassword.getValue() + ";" + renewpassword.getValue() + "测试成功了，哈哈！");
                    oldpassword.setValue("");
                    newpassword.setValue("");
                    renewpassword.setValue("");
                    Info.display(mess.systemMess1, "");
                    w.close();

                } else {
                    Info.display(mess.systemMess1, "请检查密码输入！");
                }

            }
        });

        Button changepassowrdNO = new Button("重置");
        changepassowrdNO.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                Info.display(mess.systemMess2, "密码数据已被清除！");
                panel.reset();
            }
        });

        w.addButton(changepassowrdOK);
        w.addButton(changepassowrdNO);
        w.add(panel);

        return w;
    }
}